Virtual machines provide many advantages in complex computing environments. They allow multiple operating systems execute on the same computer. The physical resources of the computer are virtualized so that the physical resources can be shared among all of the different operating systems. Each virtual machine sees itself as a real computer, even though it is implemented in software.
Virtual machines also have other advantages in addition to allowing multiple operating systems to co-exist on the same computer. Virtual machines, for example, can run independently of the underlying hardware, are isolated from each other even when executing on the same machine, and are easily provisioned and maintained.
The primary disadvantage of a virtual machine is related to efficiency. More specifically, virtual machines are not as efficient as conventional operating systems operating natively. A virtual machine is a software implementation of a computer and typically has no dedicated hardware components.
In operation, however, the virtual machine environment that allows the instantiation of virtual machines introduces additional software layers between the virtual machines and the physical resources of the computer. As a result, virtual machines are less efficient that natively executing systems because virtual machines access the physical resources of the computer indirectly.
For example, virtual machines often use virtual device drivers and it is often desirable to execute the virtual device drivers inside the virtual machines. Alternatively, virtual device drivers can be instantiated in their own virtual machine. By implementing virtual device drivers, other layers of the virtual machine environment and other virtual machines can be isolated from problems in the virtual device driver. Unfortunately, virtual machines do not have direct access to the physical resources of the computer.
As a result, virtual machines are often associated with context switches from the application to the virtual device driver and from the virtual device driver to the underlying layers of the virtual machine environment. The potentially high rate of context switches is one of the sources of reduced performance in virtual machines.